<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MarkItUp.Master" 
Inherits="System.Web.Mvc.ViewPage<List<Wikey.Entity.Space>>" %>
<%@ Import Namespace="Wikey.Utilities.Extensions"%>

<asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server">

    <h1>Spaces</h1>
    <h4> <%= Html.ActionLink("Create New " , "Create" , "Space" )%></h4>
    
    <div id="SpaceDivs">
        <% var index = 0; var mode = 3;%>
        <% foreach (var space in ViewData.Model)   { %>
        <div class="space-auto">
          <a href="<%=Html.ResolveUrl("~/Spaces/"+space.FriendlyUrlName) %>" class="space-header">
            <%=space.Name %>
          </a> <br/>
            <a class="page-create" href="<%= Html.ResolveUrl(String.Format("~/Page/Create/{{{1}@{0}}}/" , space.FriendlyUrlName , space.Id)) %>">Add Page </a>
          
            <ul id="PageList">
                
               <% foreach( var page in space.Pages) {%>
               <li>
                  <%= Html.ActionLink(page.Name, page.FriendlyName, "Pages")%>
                  </li>
               <%} %>
               
            </ul>      
        </div>
        <% index++; if (index % (mode) == 0 && index != 0) {%>
            <div style="clear:both" ></div><hr />
        <%} %>
        <%} %>
    </div>    
    
    <script type="text/javascript">
  $(document).ready(function() {
    var spaceCount = <%= ViewData.Model.Count %>;
    var mode = 3;
    var generalWidth = 95;
    var index = 0 ; 
    var row = 0 ;
    
    $("#SpaceDivs").find("div.space-auto").each(function(item,index){
      
      $(this).css({ width: (( generalWidth / mode ) + "%")});
    });
    
  });
</script>
</asp:Content>


